package cn.qf.first.controller;

import cn.qf.first.pojo.vo.RespVo;

/**
 * @date: 2021/6/21 17:30
 * @description:
 */
public class BaseController {

    //标准成功响应方法
    public RespVo convertSuccessResult(Object data){
        RespVo<Object> respVo = new RespVo<>();
        respVo.setData(data);
        return respVo;
    }

    //标准失败响应方法
    public RespVo convertFailResult(String msg){
        RespVo<Object> respVo = new RespVo<>();
        //状态码改成失败的状态码
        respVo.setCode(RespVo.CodeType.FAil.getValue());
        //添加提示语句
        respVo.setMsg(msg);
        return respVo;
    }

    //标准未登录响应方法
}
